﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using TransportLayer;

namespace TransportLayer.ExecNode
{
    public partial class NodeForm : Form
    {
        private NodeLibrary.Node node;

        public NodeForm(TransportLayer.Node cNode, int mPort)
        {
            node = new NodeLibrary.Node(cNode, mPort);
            InitializeComponent();
            nameLabel.Text = node.Name;
            this.Text = node.Name;
            node.Snp.windowHideHandler += new NodeLibrary.WindowHideHandler(Hide);
            node.Snp.windowShowHandler += new NodeLibrary.WindowShowHandler(Show);
        }


        private void NodeForm_Load(object sender, EventArgs e)
        {

        }

        private void NodeForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            node.Clean();
        }

        private void logButton_Click(object sender, EventArgs e)
        {
            LogGui log = new LogGui(node.Log);
            log.Show();
        }

        private void toolsButton_Click(object sender, EventArgs e)
        {
            ToolsGui gui = new ToolsGui(node.AvailablePortsIn,node.AvailablePortsOut, node.Sfm.ToString());
            gui.Show();
        }

        private void hideButton_Click(object sender, EventArgs e)
        {
            this.Hide();
        }

        
    }
}
